草庐IT

C++ 类 class

全部标签

iOS 单元测试 : Class is implemented in both

我正在使用Swift2和Xcode7构建iOS9应用。我的应用程序在将它部署到我的手机时运行良好,但是当我运行任何单元测试时,我收到很多类的以下错误消息:Class_TtC519isimplementedinboth/Users//Library/Developer/CoreSimulator/Devices//data/Containers/Bundle/Application/.app/and/Users///DerivedData//Build/Products/Debug-iphonesimulator/.xctest/.Oneofthetwowillbeused.Whicho

ios - 错误: CoreData: warning: Unable to load class named '' for entity 'Receipt' . 但是类被删除了

我已经为我的实体创建了一个NSManagedObject的子类,但是在我删除它之后因为我不使用它,我只在我的xcdatamodeld文件中指定了实体。当我使用这个实体时,我现在在我的控制台中收到这条消息:CoreData:警告:无法为实体“Receipt”加载名为“”的类。找不到类,而是使用默认的NSManagedObject。!我怎样才能完全删除这个类,以便CoreData不再为我的实体研究一个类? 最佳答案 您很可能仍然让您的模型尝试访问该类。进入您的XCDataModel并确保所有实体的“类名”都设置为NSManagedObj

swift - 如何将类型为 Class<Class Implementing Protocol> 的值存储在类型为 [String :Class<Protocol>] in Swift? 的字典中

我想在[String:SomeClass]类型的字典中存储一个更专业的类型。这是一些示例代码来说明我的问题(也可以在https://swiftlang.ng.bluemix.net/#/repl/579756cf9966ba6275fc794a上使用):classThing{}protocolFlavor{}classVanilla:Flavor{}vardict=[String:Thing]()dict["foo"]=Thing()它产生错误ERRORatline9,col28:cannotassignvalueoftype'Thing'totype'Thing?'.我试过转换Thi

ios - "Unknown class in interface builder file"在 Storyboard中使用从泛型类继承的类时

我最近重构了我的类BookTableViewController来自UITableViewController的简单继承,所以它现在继承自通用类FetchedResultsTableViewController它本身继承自UITableViewController.类声明如下所示:classBookTableViewController:FetchedResultsTableViewController{overridefuncviewDidLoad(){//breakpointsinheredonotcatch!}}classFetchedResultsTableViewContro

ios - Xcode 6 Beta 5 Swift 错误 : Class Exists in libswift_stdlib_core. dylib 和 libswiftCore.dylib。哪个是未定义的

所以我遇到了一个有趣的错误,它在以前的XcodeBeta版本中不存在。它在运行时从这段代码中弹出:(准确地说是第5行)funcremoveDuplicates(urls:[NSString])->[NSString]{varnewURLs=[urls[0]]forvari=0;i报错如下:objc[322]:类_NSSwiftEnumeratorBase在“MyAppFilePath.app”/Frameworks/libswift_stdlib_core.dylib和“MyAppFilePath.app”/Frameworks/libswiftCore.dylib中实现。将使用两者之

ios - swift 错误 : "class cannot be constructed because it has no accessible initializers"

Xcode给我的Swift代码报错:'myColor'cannotbeconstructedbecauseithasnoaccessibleinitializersimportFoundationprotocolPrototype{funcClone()->T}classmyColor:Prototype{varred:Int?vargreen:Int?varblue:Int?init(){}funcClone()->myColor{letnewColor=myColor()newColor.red=self.rednewColor.green=self.greennewColor.b

ios - 核心数据 : No NSValueTransformer with class name XXX was found for attribute YYYY on entity ZZZZ

我在xcdatamodel文件中设置了我的CoreData模型。我的属性YYYY有一个可转换的类型,我在数据模型检查器中设置了转换器名称。在我的案例中,我在我的模型中存储了一个[CLLocation]。classLocationArrayTransformer:NSValueTransformer{overridefunctransformedValue(value:AnyObject?)->AnyObject?{letlocations=valueas![CLLocation]returnNSKeyedArchiver.archivedDataWithRootObject(locat

ios - 在 Swift 3 中使用 LibXML2 下载时从服务器解析大型 XML

我对Swift3中LibXML2的SAX解析器有疑问。我想要iOS中来自Android的XMLPullParser之类的东西。它从服务器下载XML,并在下载时解析流。我的XML看起来像这样:因此所有数据都存储在属性中而不是子节点中。我主要根据这些示例自己制作了以下类(class):XMLPerformance,XMLPerformance-Swift和iOS-XML-StreamingimportFoundationclassLibXMLParser:NSObject,URLSessionDataDelegate{varurl:URL?vardelegate:LibXMLParserD

ios - 具有父类(super class)和子类的 Swift 协议(protocol)扩展方法分派(dispatch)

我发现了一个有趣的行为,它看起来像是一个错误......基于以下文章描述的行为:https://medium.com/ios-os-x-development/swift-protocol-extension-method-dispatch-6a6bf270ba94http://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future当我添加SomeSuperclass而不是直接采用协议(protocol)时,输出不是我所期望的。protocolTheProtocol{funcmethod1()}extensionTheProtocol{

c - swift (Linux) : Extract CMS/PKCS#7 Certs and Validate Container Signature?

我正在用Swift4编写一组将在Linux上运行的服务。我需要做的一件事是接收使用加密消息语法(CMS)格式进行数字签名的有效负载,提取用于对其进行签名的证书,然后验证签名。我知道Linux上的Swift不包含用于此类事情的Security或CommonCrypto框架,因此我已经链接到OpenSSL以尝试帮助解决这个问题。我已经离开我的C/C++编程时代大约2年了,所以我欣然承认我在这部分代码上不知所措。我有2个简单的类作为OpenSSL的包装器BIO和PKCS7数据结构。它们看起来像这样:importFoundationimportOpenSSLpublicfinalclassBI